/**
 * 
 */
package com.swim.shop.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 产品Entity
 * @author ljw
 * @version 2023-05-16
 */
@Table(name="t_product", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="product_title", attrName="productTitle", label="产品名称", queryType=QueryType.LIKE),
		@Column(name="product_class", attrName="productClass", label="产品类别", queryType=QueryType.EQ),
		@Column(name="product_introduce", attrName="productIntroduce", label="产品介绍"),
		@Column(name="sort", attrName="sort", label="排序"),
		@Column(name="price", attrName="price", label="价格"),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.sort ASC"
)
public class Product extends DataEntity<Product> {
	
	private static final long serialVersionUID = 1L;
	private String productTitle;		// 产品名称
	private String productClass;		// 产品类别
	private String productIntroduce;		// 产品介绍
	private Integer sort;		// 排序
	private Double price;		// 价格
	
	//################## 附加字段 #######################
	private String productImageUrl;	// 产品封面图片url
	
	public Product() {
		this(null);
	}

	public Product(String id){
		super(id);
	}
	
	@NotBlank(message="产品名称不能为空")
	@Length(min=0, max=100, message="产品名称长度不能超过 100 个字符")
	public String getProductTitle() {
		return productTitle;
	}

	public void setProductTitle(String productTitle) {
		this.productTitle = productTitle;
	}
	
	@NotBlank(message="产品类别不能为空")
	@Length(min=0, max=30, message="产品类别长度不能超过 30 个字符")
	public String getProductClass() {
		return productClass;
	}

	public void setProductClass(String productClass) {
		this.productClass = productClass;
	}
	
	@NotBlank(message="产品介绍不能为空")
	public String getProductIntroduce() {
		return productIntroduce;
	}

	public void setProductIntroduce(String productIntroduce) {
		this.productIntroduce = productIntroduce;
	}
	
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	@NotNull(message="价格不能为空")
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getProductImageUrl() {
		return productImageUrl;
	}

	public void setProductImageUrl(String productImageUrl) {
		this.productImageUrl = productImageUrl;
	}
	
}